Repository navigation
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 9 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
| If ``backend="cupy"``, the eigenvalues of a square operator | ||
| can be computed only when in symmetric (``symmetric=True``), | ||
| since CuPy does not provide an equivalent | ||
| of :func:`scipy.sparse.linalg.eigs`. A | ||
| :obj:`NotImplementedError` is raised. |
There was a problem hiding this comment.
This would be a cool paper to implement to get this to work without quadratic memory required by Arnoldi: https://arxiv.org/abs/2407.03208
There was a problem hiding this comment.
Nice 😄 I agree, looks very interesting.
And I am not super-happy about all of the edge/missing cases I discovered in cupy/cupyx.scipy eigensolvers, but I have the impressions things will just keep coming and eventually unify more and more with scipy, so for now I decided to try to document and raise errors in (hopefully) all cases... and leave end users with the last resort of PyLops power_method if they are after the largest eigenvalue only - which is the most common use case, anyways 😉
This PR adds support for CuPy in
LinearOperator.eigsandLinearOperator.cond.However, since not all methods in scipy are not available in cupy (eg
scipy.sparse.linalg.eigs), and some input parameters are missing or have missing options (egSMincupyx.scipy.sparse.linalg.eigsh), a number of checks and error raises are required.Moreover, some cupyx eigenvalue solvers seem to require
self.ndimthat scipy/cupy.LinearOperator define asself.ndim = len(self.shape)(note that the equivalent scipy eigenvalue solvers don't...). To accommodate for it, every operator that usedself.ndiminternally (eg FFT) is now modified to useself.ndimssoself.ndimcan be defined for the baseclass pylops.LinearOperator too and made available to all operators.